import 'package:flutter/material.dart';

class TextPage extends StatefulWidget {
  @override
  _TextPageState createState() {
    return new _TextPageState();
  }
}

class _TextPageState extends State<TextPage> {
  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(title: new Text('文本')),
      body: Container(
          width: MediaQuery.of(context).size.width,
          child: Flex(
            direction: Axis.vertical,
            children: <Widget>[
              Text('常规文本'),
              Text(
                '有样式文本',
                style: TextStyle(
                  color: Colors.blue,
                  fontSize: 18.0,
                  height: 1.2,
                  fontFamily: "Courier",
                  background: new Paint()..color = Colors.yellow,
                  decoration: TextDecoration.underline,
                  decorationStyle: TextDecorationStyle.dashed
                ),
              ),
              Container(
                width: MediaQuery.of(context).size.width,
                child: Text(
                  '左对齐文本',
                  textAlign: TextAlign.left,
                ),
              ),
              Container(
                width: MediaQuery.of(context).size.width,
                child: Text(
                  '居中对齐文本',
                  textAlign: TextAlign.center,
                ),
              ),
              Container(
                width: MediaQuery.of(context).size.width,
                child: Text(
                  '右对齐文本',
                  textAlign: TextAlign.right,
                ),
              ),
              Text(
                "重复6次- " * 6, //字符串重复六次
                textAlign: TextAlign.center,
              ),
              Text.rich(TextSpan(children: <TextSpan>[
                TextSpan(text: 'TextSpan'),
                TextSpan(
                  text: 'https://flutterchina.club',
                  style: TextStyle(color: Colors.blue),
                ),
              ]))
            ],
          )),
    );
  }
}
